package com.github.yealove.configgen.mapper;

import com.github.yealove.configgen.model.Config;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ConfigMapper {

    @Select("select * from cg_config where gid = #{gid} order by sort")
    List<Config> getByGid(@Param("gid") int gid);

    @Delete("delete from cg_config where gid = #{gid}")
    void deleteByGid(int gid);

    @Insert("insert into cg_config(gid,c_key,c_value,sort) values(#{gid},#{cKey},#{cValue},#{sort})")
    void addConfig(Config config);
}
